Skip to content

Conversation

@hodanoori
Copy link
Contributor

@hodanoori hodanoori commented Feb 9, 2026

Summary

Route search validation no longer relies on Zod’s ctx.path in z.preprocess (removed in Zod v4). A small helper filters URL search params by known keys and allowed prefixes before parsing with Zod, so the same behavior works with Zod v3 and v4. Upgraded Zod from v3 to v4 (exact version 4.3.6).

Changes Made

  1. Added filterSearchParamsByPrefix(raw, knownKeys, allowedPrefixes) in heureka (utils.ts), supernova (lib/utils.ts), doop (lib/helpers.ts), and greenhouse (lib/helpers.ts).
  2. Updated heureka /services and /vulnerabilities routes to validate search via the helper + schema (no preprocess using ctx.path).
  3. Updated supernova /alerts route to use the helper with ACTIVE_FILTERS_PREFIX and PAUSED_FILTERS_PREFIX.
  4. Updated doop /violations route to use the helper with ACTIVE_FILTERS_PREFIX.
  5. Updated greenhouse /admin/plugin-presets route to use the helper with SELECTED_FILTER_PREFIX (Zod v4–compatible).
  6. Typed supernova getFiltersForUrl as Record<string, string | string[]> and adjusted implementation so search param types align with the route schema.
  7. Removed unnecessary type assertions in carbon ErrorFallback (use instanceof Error and fallback for empty message) and in doop/supernova validate-search return values.
  8. Upgraded Zod from v3 to v4 (exact version 4.3.6); route search validation uses filterSearchParamsByPrefix instead of ctx.path.

Related Issues

Screenshots (if applicable)

none

Testing Instructions

  1. pnpm i
  2. pnpm TASK

Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • My changes generate no new warnings or errors.
  • I have created a changeset for my changes.

PR Manifesto

Review the PR Manifesto for best practises.

@hodanoori hodanoori requested a review from a team as a code owner February 9, 2026 16:01
@changeset-bot
Copy link

changeset-bot bot commented Feb 9, 2026

🦋 Changeset detected

Latest commit: 515d61a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@cloudoperators/juno-app-greenhouse Patch
@cloudoperators/juno-app-supernova Patch
@cloudoperators/juno-app-heureka Patch
@cloudoperators/juno-app-doop Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@hodanoori hodanoori self-assigned this Feb 9, 2026
@hodanoori hodanoori changed the title Hoda upgrade zod v4 chore(greenhouse): makes route search validation Zod v4–ready (filter by prefix before parse) Feb 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

PR Preview Action v1.6.3

🚀 View preview at
https://cloudoperators.github.io/juno/pr-preview/pr-1446/

Built to branch gh-pages at 2026-02-11 08:50 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@hodanoori hodanoori changed the title chore(greenhouse): makes route search validation Zod v4–ready (filter by prefix before parse) chore(greenhouse): makes route search validation Zod v4–ready (filter by prefix before parse) and upgrade zod to v4 Feb 10, 2026
Copy link
Contributor

@taymoor89 taymoor89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this zod update touches code as well let's add changeset to update patch version of the apps changed.

@hodanoori hodanoori requested a review from taymoor89 February 12, 2026 09:52
/**
* Filters raw URL search params to only known keys and keys that start with any allowed prefix.
* Use this before Zod parsing when you need prefix-based catchall validation
* (Zod v4 no longer provides ctx.path in preprocess).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not mention the zod version changes - not important after merge

Copy link
Contributor

@taymoor89 taymoor89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM 👍

/**
* Filters raw URL search params to only known keys and keys that start with any allowed prefix.
* Use this before Zod parsing when you need prefix-based catchall validation
* (Zod v4 no longer provides ctx.path in preprocess).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not mention the changes from zod 3 > 4.

/**
* Filters raw URL search params to only known keys and keys that start with any allowed prefix.
* Use this before Zod parsing when you need prefix-based catchall validation
* (Zod v4 no longer provides ctx.path in preprocess).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would not mention changes from zod3 > 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants